import 'package:flutter_ducafecat_news/common/entitys/home_banner_entity.dart';

homeBannerEntityFromJson(HomeBannerEntity data, Map<String, dynamic> json) {
	if (json['totalNumber'] != null) {
		data.totalNumber = json['totalNumber']?.toInt();
	}
	if (json['data'] != null) {
		data.data = new List<HomeBannerData>();
		(json['data'] as List).forEach((v) {
			data.data.add(new HomeBannerData().fromJson(v));
		});
	}
	if (json['resCode1'] != null) {
		data.resCode1 = json['resCode1']?.toString();
	}
	if (json['resCode'] != null) {
		data.resCode = json['resCode']?.toString();
	}
	if (json['resMsg'] != null) {
		data.resMsg = json['resMsg']?.toString();
	}
	return data;
}

Map<String, dynamic> homeBannerEntityToJson(HomeBannerEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['totalNumber'] = entity.totalNumber;
	if (entity.data != null) {
		data['data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	data['resCode1'] = entity.resCode1;
	data['resCode'] = entity.resCode;
	data['resMsg'] = entity.resMsg;
	return data;
}

homeBannerDataFromJson(HomeBannerData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['title'] != null) {
		data.title = json['title']?.toString();
	}
	if (json['isdetail'] != null) {
		data.isdetail = json['isdetail']?.toString();
	}
	if (json['url'] != null) {
		data.url = json['url']?.toString();
	}
	if (json['createdate'] != null) {
		data.createdate = json['createdate']?.toInt();
	}
	if (json['orderno'] != null) {
		data.orderno = json['orderno']?.toInt();
	}
	if (json['jumpUrl'] != null) {
		data.jumpUrl = json['jumpUrl']?.toString();
	}
	if (json['imgurl'] != null) {
		data.imgurl = json['imgurl']?.toString();
	}
	if (json['jumptype'] != null) {
		data.jumptype = json['jumptype']?.toString();
	}
	if (json['iosUrl'] != null) {
		data.iosUrl = json['iosUrl']?.toString();
	}
	if (json['andriodUrl'] != null) {
		data.andriodUrl = json['andriodUrl']?.toString();
	}
	if (json['wechatUrl'] != null) {
		data.wechatUrl = json['wechatUrl']?.toString();
	}
	if (json['xcxUrl'] != null) {
		data.xcxUrl = json['xcxUrl']?.toString();
	}
	if (json['isNeedLogin'] != null) {
		data.isNeedLogin = json['isNeedLogin']?.toString();
	}
	if (json['status'] != null) {
		data.status = json['status']?.toInt();
	}
	if (json['platform'] != null) {
		data.platform = json['platform']?.toString();
	}
	if (json['ordernoM'] != null) {
		data.ordernoM = json['ordernoM']?.toInt();
	}
	if (json['ordernoApp'] != null) {
		data.ordernoApp = json['ordernoApp']?.toInt();
	}
	if (json['ordernoWeb'] != null) {
		data.ordernoWeb = json['ordernoWeb']?.toInt();
	}
	if (json['ordernoXcx'] != null) {
		data.ordernoXcx = json['ordernoXcx'];
	}
	if (json['webUrl'] != null) {
		data.webUrl = json['webUrl']?.toString();
	}
	if (json['updatetime'] != null) {
		data.updatetime = json['updatetime']?.toInt();
	}
	return data;
}

Map<String, dynamic> homeBannerDataToJson(HomeBannerData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['title'] = entity.title;
	data['isdetail'] = entity.isdetail;
	data['url'] = entity.url;
	data['createdate'] = entity.createdate;
	data['orderno'] = entity.orderno;
	data['jumpUrl'] = entity.jumpUrl;
	data['imgurl'] = entity.imgurl;
	data['jumptype'] = entity.jumptype;
	data['iosUrl'] = entity.iosUrl;
	data['andriodUrl'] = entity.andriodUrl;
	data['wechatUrl'] = entity.wechatUrl;
	data['xcxUrl'] = entity.xcxUrl;
	data['isNeedLogin'] = entity.isNeedLogin;
	data['status'] = entity.status;
	data['platform'] = entity.platform;
	data['ordernoM'] = entity.ordernoM;
	data['ordernoApp'] = entity.ordernoApp;
	data['ordernoWeb'] = entity.ordernoWeb;
	data['ordernoXcx'] = entity.ordernoXcx;
	data['webUrl'] = entity.webUrl;
	data['updatetime'] = entity.updatetime;
	return data;
}